import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "@vant/auto-import-resolver";

export default defineConfig({
  base: './',

  server: {
    host: '0.0.0.0',
    port: 8998, //自定义端口
    proxy: {
      '/index.php': {
        target: 'http://xc2025.xcyu.luqgy.com/',
        changeOrigin: true,
      rewrite: (path) => path.replace(/^\/api/, '')
      },

    }
  },
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
});
